﻿<?php
error_reporting(0);
include("../config/header.php");
?>
<script type='text/javascript'>
	document.title = 'Cisco思科密码在线解密 —— 在线工具';
</script>
<?php
function decisco7($str){
	$valeur=0;
	$seed=0;
	$key = array(
		   0x64,0x73,0x66,0x64,
		   0x3b,0x6b,0x66,0x6f,
		   0x41,0x2c,0x2e,0x69,
		   0x79,0x65,0x77,0x72,
		   0x6b,0x6c,0x64,0x4a,
		   0x4b,0x44,0x48,0x53,
		   0x55,0x42);
	$len_str = strlen($str);
	$str = strtolower($str);
	if ($len_str < 4){
        echo '<p><b>错误：</b>字符串太短</p>';
        return(0);
    }
	if ($len_str > 100){
        echo '<p><b>错误：</b>字符串太长</p>';
        return(0);
    }
	if (($len_str % 2) != 0){
		echo '<p><b>错误： </b>字符串长度不匹配</p>';
		return(0);
	}
	for ($i=0;$i<$len_str;$i++){
		if (((($str[$i]>='0')&&($str[$i]<='9')) || (($str[$i]>='a')&&($str[$i]<='f')))==0){
			echo '<p><b>错误：'.$str.' </b>字符'.($i+1).' 字符串不匹配 </p>';
			exit;
		}
	}
	$seed=($str[0]-'0')*10+($str[1]-'0');
	for ($i=2;$i<=$len_str;$i++){          
		if ( ($i!=2) && !($i&1) ){
			$password_en_claire[$i/2-2]=$valeur^$key[$seed];
			$seed++;
			$valeur=0;
		}
		$valeur=$valeur*16;
		if( ($str[$i]>='0') && ($str[$i]<='9') )
			$valeur=$valeur+ord($str[$i])-ord('0');
		else if ( ($str[$i]>='a') && ($str[$i]<='f') )
			$valeur=$valeur+ord($str[$i])-ord('a')+10;
	}
	$len_password_claire=($len_str/2)-1;
	$password_en_claire_format_chaine=join(array_map('chr',$password_en_claire));
	return $password_en_claire_format_chaine;
}
$treat = false;
if (isset($_POST['src'])){
	$src = $_POST['src'];
	$pass = decisco7($src);
	$treat = true;
}
?>
<div class="container">
	<div class="alert alert-info" role="alert">非常感谢网友hackercc分享此源码</div>
	<div class="panel panel-primary">
		<div class="panel-heading"><h3 class="panel-title">Cisco 密码解密</h3></div>
	</div>
		<form method="post" name="fmCalcu" id="fmCalcu" action="">
		<div class="input-group">
			<input name="src" value="<?php if ($treat) { echo $pass; } else { echo '080949420516'; } ?>" placeholder="Please input to here ..." type="text" class="form-control"/>
			<span class="input-group-btn scan-but-span">
			<input name="submit1" type="submit" class="btn btn-success" id="submit1" value=" 解 密 " />
			</span>
		</div>
		</form>

</div>
<?php
include("../config/footer.php");
?>
